<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
	<% String path=request.getContextPath(); String basePath=request.getScheme() + "://" + request.getServerName() + ":"
		+ request.getServerPort() + path + "/" ; %>

		<!DOCTYPE html>
		<html>

		<head>
			<base href="<%=basePath%>">

			<title>海科新源业务协同管理平台(CMP)</title>

			<meta http-equiv="pragma" content="no-cache">
			<meta http-equiv="cache-control" content="no-cache">
			<meta http-equiv="expires" content="0">
			<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
			<meta http-equiv="description" content="This is my page">
			<!-- <link rel="stylesheet" href="resourse/layui-v2.4.3/layui/css/layui.css"> -->
			<style>
				/*重点代码*/
				/*默认*/
				.tree-icon {
					background: url('resourse/jquery-easyui-1.4.5/themes/icons/file.png') no-repeat center center !important;
				}

				/*折叠时图片*/
				.tree-folder {
					background: url('resourse/jquery-easyui-1.4.5/themes/icons/folder-close.png') no-repeat center center !important;
				}

				/*展开时图片*/
				.tree-folder-open {
					background: url('resourse/jquery-easyui-1.4.5/themes/icons/folder.png') no-repeat center center !important;
				}
			</style>

		</head>

		<body class="easyui-layout">

			<%@ include file="/WEB-INF/jsp/common/header.jsp" %>
				<%@ include file="/WEB-INF/jsp/common/loadDiv.jsp" %>

					<div data-options="region:'north',border:false"
						style="padding: 0px; overflow: hidden; height: 35px;">

						<div style="height: 30px; padding: 5px; background-color: #10a0ea;">
							<div style="float: left;">
								<span
									style="font-size: 18px; font-weight: bolder; color: #fff;">海科新源业务协同管理平台(CMP)</span>
							</div>
							<div style="float: right; margin: 0 100px 0 0; color: #020202;">
								<a href="javascript:" class="easyui-linkbutton" data-options="plain:true"
									style="color: #020202;">欢迎您：<span id="username"></span></a> <a href="javascript:;"
									onclick="add('sys/index','首页');" class="easyui-linkbutton" data-options="plain:true"
									style="color: #020202;">首页</a> <a href="javascript:;"
									onclick="add('sys/ChangePwd','修改密码');" data-options="plain:true"
									class="easyui-linkbutton" style="color: #020202;">修改密码</a><a
									href="javascript:logout()" data-options="plain:true" class="easyui-linkbutton"
									style="color: #020202;">退出</a><a href="resourse/海科新源业务协同管理平台使用说明书.docx"
									data-options="plain:true" class="easyui-linkbutton" style="color: #020202;">使用手册</a>

							</div>
						</div>

						<!-- 		<div -->
						<!-- 			style="text-align: right; position: absolute; top: 0px; right: 10px;"> -->

						<!-- 			<ul id="shortcut"> -->
						<!-- 				<li><a href="javascript:;" title="首页" -->
						<!-- 					onclick="add('/Home/Default','首页');"> <img -->
						<!-- 						src="resourse/img/login/homeico.png" /> <span>首页</span> -->
						<!-- 				</a></li> -->
						<!-- 				<li><a href="javascript:;" title="修改密码" -->
						<!-- 					onclick="add('/Sys/ChangePWD','修改密码');"> <img -->
						<!-- 						src="resourse/img/login/pwdico.png" /><span>修改密码</span> -->
						<!-- 				</a></li>  -->
						<!-- 				<li><a href="sys/logout" title="退出系统"> <img -->
						<!-- 						src="resourse/img/login/quitico.png" /><span>退出系统</span> -->
						<!-- 								</a></li> -->
						<!-- 			</ul> -->
						<!-- 		</div> -->
					</div>
					<div data-options="region:'west',split:true,title:'工具栏'" style="width: 180px; padding: 10px;">
						<ul id="tt"></ul>
					</div>
					<div data-options="region:'center'">
						<div id="main" class="easyui-tabs" style="width: 99%; height: auto; padding: 0px;"
							data-options="iconCls:'icon-save',collapsible:false,minimizable:false,maximizable:false,closable:false,tools:'#tab-tools111'"
							fit="true" border="0">
							<!--工作区-->
						</div>
						<div id="tab-tools111" style="border-top: none; border-right: none;">
							<a href="javascript:void(0)" class="easyui-linkbutton" plain="true"
								data-options="plain:true,iconCls:'icon-reload'" onclick="refresh()">刷新</a>
						</div>
						<div id="tab_rightmenu" class="easyui-menu" style="width: 150px; display: none;">
							<!-- 	<div name="tab_menu-tabclose">关闭</div> -->
							<div name="tab_menu-tabcloseall">关闭全部标签</div>
							<div name="tab_menu-tabcloseother">关闭其他标签</div>
							<div class="menu-sep"></div>
							<div name="tab_menu-tabcloseright">关闭右侧标签</div>
							<div name="tab_menu-tabcloseleft">关闭左侧标签</div>
						</div>
					</div>
					<div data-options="region:'south',border:false"
						style="height: 30px; line-height: 30px; padding-left: 10px; text-align: center;">
						<span> 山东海科新源材料科技股份有限公司 </span>
					</div>

					<script type="text/javascript">
						$(function () {
							$("#username").html(PUser.username)
							//绑定左侧Tree
							$('#tt').tree(
								{
									url: 'sys/selectModuleMap?userid=' + PUser.userid,
									lines: true,
									onClick: function (node) {
										if (node.attributes.url != '#'
											&& node.attributes.url != '') { // alert node text property when clicked
											add(node.attributes.url, node.text);
										}
									},
									onLoadSuccess: function () {
										// 							$('#tt').tree('collapseAll');
										//var rows = $('#tt').tree('getChildren');
										//alert(rows[0].ID);
										//if (rows.length) {
										//    $('#tt').tree('expand', rows[0].ID);
										//}
										// 														  $('#tt .tree-icon').css("background", "url(resourse/jquery-easyui-1.4.5/themes/icons/arrow-down.png) no-repeat center center");
									}
								});
							//add("/PluginSrc/StatisticalSystem/Manage/ReportStateList.aspx", "首页");
							var tabsId = 'main'; //tabs页签Id
							var tab_rightmenuId = 'tab_rightmenu'; //tabs右键菜单Id

							//绑定tabs的右键菜单
							$("#" + tabsId).tabs({
								onContextMenu: function (e, title) {//这时去掉 tabsId所在的div的这个属性：class="easyui-tabs"，否则会加载2次
									e.preventDefault();
									$('#' + tab_rightmenuId).menu('show', {
										left: e.pageX,
										top: e.pageY
									}).data("tabTitle", title);
								}
							});

							//实例化menu的onClick事件
							$("#" + tab_rightmenuId).menu({
								onClick: function (item) {
									CloseTab(tabsId, tab_rightmenuId, item.name);
								}
							});

							add('sys/index', '首页');
						});

						function logout() {
							$.messager.confirm('确认提示', '确认退出?', function (r) {
								if (r) {
									$.ajax({
										type: "post",
										dataType: "json",
										url: 'sys/logoff?',
										data: {
										},
										contentType: "application/json",
										success: function (data) {
											if (data.code == 60200) {
												window.location.href = 'sys/login'
											} else {
												$.messager.alert('消息', data.msg);
											}
										},
										error: function (XMLHttpRequest, textStatus, errorThrown) {
											$.messager.alert('消息', errorThrown);
										}
									})
								}
							})
						}

						var index = 0;

						function add(url, title) {
							if ($('#main').tabs('exists', title)) {
								if (confirm('已经打开了页面,是否关闭并重新加载该标签？\n警告：点击[确定]会关闭原有的标签页面并重新加载！！！如果你还没有保存过数据,请选【取消】！,')) {
									//$('#tt').tabs('select', title);
									$('#main').tabs('close', title);
									$('#main')
										.tabs(
											'add',
											{
												title: title,
												content: "<iframe scrolling=\"auto\" frameborder=\"0\" Src=\""
													+ url
													+ "\" Style=\"width:100%;height:99%;\"></iframe>",
												iconCls: 'icon-applicationgo',
												closable: true
											});
								} else {
									$('#main').tabs('select', title);
								}
							} else {
								$('#main')
									.tabs(
										'add',
										{
											title: title,
											content: "<iframe scrolling=\"auto\" frameborder=\"0\" Src=\""
												+ url
												+ "\" Style=\"width:100%;height:99%;\"></iframe>",
											iconCls: 'icon-applicationgo',
											closable: true
										});
							}
						}

						function refresh() {
							var currTab = $('#main').tabs('getSelected'); //获得当前tab
							if (currTab) {
								var url = $(currTab.panel('options').content).attr('src');
								var title = currTab.panel('options').title;
								$('#main').tabs('close', title);
								add(url, title);
							}
						}
					</script>
					<!-- 	<script src="resourse/layui-v2.4.3/layui/layui.js"></script> -->
					<!-- 	<script> -->
					<!-- 	</script> -->
		</body>

		</html>